<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.yaodian100.core.common.utils.ServerValue" %>
<%@ include file="/taglibs.jsp"%>
<%@taglib uri="/WEB-INF/tld/pageutil.tld" prefix="pu"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<script>
$(function(){
	$('#moreWoA').click(function(){
		$('#moreWo').show();
	});
});
</script>
<c-rt:if test="${!empty message}">
${message }
</c-rt:if>
<c-rt:if test="${empty message}">
${message }
<script>
function openUpdateProcessLog(){
openDialog2('处理历程','updateProcessLogDialog');
}
var blankVar;
</script>
<%
try{
%>
${pu:reqSet('workOrderId', param.id) }
<c-rt:if test="${!empty id}">
${pu:reqSet('workOrderId', id) }
</c-rt:if>

<c-rt:set var="workOrder" scope="request" value="${pu:get('com.yaodian100.crm.workorder.entity.WorkOrder', pu:parseLong(workOrderId))}"/>
<c-rt:set var="question" scope="request" value="${pu:get('com.yaodian100.crm.cs.entity.Question', workOrder.domainId)}"/>

<c-rt:if test="${!empty param.questionType}">
<c-rt:set var="questionType" value="${param.questionType }" scope="request"/>
</c-rt:if>
<c-rt:if test="${empty param.questionType}">
<c-rt:set var="questionType" value="${question.type.name }" scope="request"/>
</c-rt:if>
<c-rt:if test="${!empty question.memberId}">
<c-rt:set var="member" value="${pu:get('com.yaodian100.ec.member.entity.Member', question.memberId)}"/>
</c-rt:if>
<c-rt:set var="fromChannels" value="${pu:queryByHql('from FromChannel', null, null)}"/>
${pu:reqSet('user', pu:user()) }
	<script language="javascript">
	$(document).ready( function() {
		$('#submit_button').click(function(){
			message='';
			if(document.theForm.fromChannel.value==''){
				message+='请选择channel\r\n';
			}
			if(document.theForm.commonQuestionTypeId.value==''){
				message+='请选择问题单类型\r\n';
			}
			if(message==''){
				
				doAR('<%=application.getContextPath() %>/cs/updateQuestion.do', 'main', 'theForm');
			}else{
				alert(message);
			}
		});
		$('#cqtMain').change(function(){
			doAR('<%=application.getContextPath() %>/cs/page.do?iamlazy=subTypeList&parentId='+document.theForm.cqt.value, 'commonQuestionTypeIdZone');
		});
	});
	function submitForm(responser, workFlowNodeId){
		doAR('<%=application.getContextPath() %>/cs/createOrderAndQuestion.do?responser='+responser+'&workFlowNodeId='+workFlowNodeId, 'main', 'theForm');
	}
	function submitForwardForm(type, responser, workFlowNodeId){
		var url;
		if(type==1){
			url='<%=application.getContextPath() %>/workOrder/forwardOrder.do';
		}else if(type==2){
			url='<%=application.getContextPath() %>/workOrder/backwardOrder.do';
		}
		doAR(url+'?responser='+responser+'&workFlowNodeId='+workFlowNodeId, 'main', 'theForm');
	}
	function closeOrder(action){
		$('.buttons').hide();
		if(action){

		}else{
			action='/ecadmin/workOrder/closeOrder.do';
		}
		var error="";
		<c-rt:if test="${empty workOrder.parent && pu:user().group.code=='C.01' && !empty member.memberId}">
		if(document.answerForm.answer && document.answerForm.answer.value==''){
			error+='请填写回覆内容\r\n';
		}
		</c-rt:if>
		if(error!=''){
			alert(error);
			$('.buttons').show();
		}else{
			<c-rt:if test="${empty workOrder.parent && pu:user().group.code=='C.01' && !empty member.memberId}">
			if(document.answerForm.answer){
				document.answerForm.answer.value = document.answerForm.answer.value.replace(new RegExp("\"","gm"),"&#39;");
			}
			</c-rt:if>
			document.answerForm.note.value = document.answerForm.note.value.replace(new RegExp("\"","gm"),"&#39;");
			doAR(action, 'main', 'answerForm');
		}
		}
	</script>
<br/>
<h1>
					<c-rt:if test="${question.type.name=='CommonQuestion' }">
						<c-rt:if test="${question.extraValue['isProductQAA'].value=='true' }">
							商品问答
						</c-rt:if>
						<c-rt:if test="${question.extraValue['isProductQAA'].value!='true' }">
							客服问答
						</c-rt:if>
					</c-rt:if>
					<c-rt:if test="${question.type.name!='CommonQuestion' }">
					${question.type.description }
					</c-rt:if>
</h1>
<b>工单ID:</b>${workOrder.id } / <b>问题单号:</b>${question.id }
<c-rt:if test="${!empty question.orgQuestionId}">
(原问题单号:${question.orgQuestionId })
</c-rt:if>
 / 建立人：${workOrder.createUser } / 处理人： <c:if test="${!empty workOrder.owner.username}">${pu:get('com.yaodian100.core.admin.entity.User', workOrder.owner.username).nameNative } (${workOrder.owner.username })</c:if>
<c-rt:if test="${question.isMember}">
<table width="100%"><tr><td>
<table class="tb-data" width="100%">
  <tr>
    <th>会员编号</th>
    <td><a target="_blank" href="<c-rt:url value="/member/popView.do?memberId=${member.memberId }"/>">${member.memberId}</a></td>
    <th>登入代码</th>
    <td>${member.loginId}</td>
    <th>姓名</th>
    <td>${member.name}</td>
  </tr>
  <tr>
    <th>性别</th>
    <td>
    <c-rt:if test="${!empty member.sex}">
    ${member.sex eq 'M' ? '男' : '女'}
    </c-rt:if>
    </td>
    <th>电子邮件</th>
    <td>${member.email}</td>
    <th>生日</th>
    <td><fmt-rt:formatDate value="${member.birthday}" pattern="yyyy/MM/dd"/></td>
  </tr>
  <tr>
    <th>住家电话</th>
    <td>${member.homePhone}</td>
    <th>公司电话</th>
    <td>${member.companyPhone}</td>
    <th>行动电话</th>
    <td>${member.mobile}</td>
  </tr>
  <tr>
    <th>联络地址</th>
    <td colspan="5"> ${member.zipCode} - 
      ${member.province } ${member.city} ${member.district} ${member.addr} </td>
  </tr>
  <tr>
    <th>会员状态</th>
    <td>${memberStatus.options[member.status].name}</td>
    <th>会员等级</th>
    <td>${memberRank.options[member.rank].name}</td>
    <th>申请来源</th>
    <td>${member.applySource}</td>
  </tr>
</table>

</td>
<td valign="top" width="200">
<c-rt:if test="${workOrder.owner.username==pu:username() && (workOrder.status=='0' || workOrder.status=='4')}">
<table  class="tb-data" id="viewProcessLog" style="width:230px">
<tr>
<th>处理历程</th>
</tr>
<tr>
<td>

<div id="processLog" style="height:90px;width:200px;overflow:auto">
${pu:reqSet('processLog', workOrder.processLog)}
   <%
   String processLog=(String)request.getAttribute("processLog");
   if(processLog!=null){
   	processLog=processLog.replaceAll("\r\n", "<br/>");
   }
   request.setAttribute("processLog", processLog);
   %>
${processLog }
</div>
</td>
</tr>
<tr>
<td>
<input type="button" value="更新历程" onclick="document.updateProcessLogForm.processLog.value='';$('#viewProcessLog').hide();$('#editProcessLog').show();"/><span id="updateProcessLog"></span>
</td>
</tr>
</table>
<form name="updateProcessLogForm" method="post">
<input type="hidden" name="workOrderId" value="${workOrder.id }"/>
<table  class="tb-data" id="editProcessLog" style="display:none;width:230px">
<tr>
<th>处理历程</th>
</tr>
<tr>
<td>
<textarea name="processLog" cols="25" rows="5"></textarea>
</td>
</tr>
<tr>
<td>
<input type="button" value="更新" onclick="if(confirm('确定要更新备注？')){doAR('<%=application.getContextPath() %>/workOrder/updateProcessLog.do', 'updateProcessLog', 'updateProcessLogForm');$('#editProcessLog').hide();$('#viewProcessLog').show();}"/>
</td>
</tr>
</table>
</form>
</c-rt:if>
<c-rt:if test="${workOrder.owner.username!=pu:username() || (workOrder.status!='0' && workOrder.status!='4')}">
<table  class="tb-data">
<tr>
<th>处理历程</th>
</tr>
<tr>
<td>
${workOrder.processLog }
</td>
</tr>
</table>

</c-rt:if>



</td>
</tr>
</table>
</c-rt:if>
<c-rt:if test="${!question.isMember}">

</c-rt:if>
<script type="text/javascript">
	$(function() {
		$("#tabs").tabs();
	});
	</script>

<c-rt:if test="${!empty question.extraValue['orderId'].value}">
<iframe src="<%=ServerValue.getBackHostname() %>/erp/crm/so/crmViewStatus.do?vw_orderId=${question.extraValue['orderId'].value }" width="100%" height="220px" frameborder="0">

</iframe>
</c-rt:if>

<div class="demo">
<c-rt:if test="${!empty question.extraValue['class1'].value}">
	<c-rt:set var="cqt" value="${pu:get('com.yaodian100.crm.cs.entity.CommonQuestionType', question.extraValue['class1'].value)}"/>
    <c-rt:set var="class1" value="${cqt.name }"/>	
</c-rt:if>
<div id="tabs">
	<ul>
		<li><a href="#questionDetail">问题内容</a></li>
        <c-rt:if test="${!empty question.extraValue['orderId'].value}">
		<li><a href="#orderDetail">订单</a></li>
        </c-rt:if>
        <c-rt:if test="${!empty question.extraValue['returnId'].value}">
		<li><a href="#returnProductDetail">退货单</a></li>
        </c-rt:if>
        <c-rt:if test="${!empty question.extraValue['changeId'].value}">
        <li><a href="#changeProductDetail">换货单</a></li>
        </c-rt:if>
        <c-rt:if test="${!empty question.extraValue['productId'].value}">
        <li><a href="#productDetail">商品</a></li>
        </c-rt:if>
        <c-rt:if test="${workOrder.owner.username==pu:username()&& workOrder.status!=3 && workOrder.status!=2 && workOrder.approveStatus!=0 && workOrder.status!=1}">
        <li><a href="#forwardOrder">转单</a></li>
        </c-rt:if>
        <c-rt:if test="${workOrder.status==2}">
        
        <li><a href="#replyDetail">回覆内容</a></li>
        
        </c-rt:if>
        <c-rt:if test="${pu:isCRMManager(pu:username())}">
        ${pu:listAdd('theList', workOrder.id)}
        ${pu:reqSet('nextWorkOrders', pu:queryByHql('from WorkOrder where parent.id=?', pu:arrayGet('theList'), null))  }
        	<c-rt:if test="${!empty nextWorkOrders}">
        	  <li><a href="#nextWorkOrder">转单内容</a></li>
        	</c-rt:if>
        </c-rt:if>
        ${pu:listAdd('fromParams', workOrder.id) }
        ${pu:reqSet('fromWorkOrders', pu:queryByHql('from WorkOrder where fromWorkOrder.id=?',pu:arrayGet('fromParams'), null))  }
        <c-rt:if test="${!empty fromWorkOrders}">
        	<li><a href="#fromWorkOrder">再次进线</a></li>
        </c-rt:if>
        <c-rt:if test="${class1 eq '问题投诉' or class1 eq '网站服务建议'}">
        	${pu:listAdd('attParams', question.id) }
        	${pu:reqSet('questionAttach', pu:queryByHql('from QuestionAttach where questionId=?',pu:arrayGet('attParams'), null))  }
			<li><a href="#attach">附件</a></li>
        </c-rt:if>
	</ul>
	<div id="questionDetail">
    <table width="100%" border="1" cellspacing="0" cellpadding="0" class="tb-data">
      <tr>
        <td height="30" align="left"><b>问题类别：</b> 
        <c-rt:if test="${!empty question.extraValue['class1'].value}">
        <c-rt:set var="cqt" value="${pu:get('com.yaodian100.crm.cs.entity.CommonQuestionType', question.extraValue['class1'].value)}"/>
        <c-rt:set var="class1" value="${cqt.name }"/>
				${cqt.name} /
                </c-rt:if>                
                <c-rt:if test="${!empty question.extraValue['class2'].value}">
        <c-rt:set var="cqt" value="${pu:get('com.yaodian100.crm.cs.entity.CommonQuestionType', question.extraValue['class2'].value)}"/>
				${cqt.name} /
                </c-rt:if>
                <c-rt:if test="${!empty question.extraValue['commonQuestionType'].value}">
        <c-rt:set var="cqt" value="${pu:get('com.yaodian100.crm.cs.entity.CommonQuestionType', question.extraValue['commonQuestionType'].value)}"/>
		  ${cqt.name} </c-rt:if></td>
        <td align="left"><b>必问问题：</b><br/>
         <c-rt:if test="${!empty question.extraValue['mustInquire'].value}">
					<c-rt:set var="values" value="${pu:split(question.extraValue['mustInquire'].value, ',')}"/>
					<c-rt:forEach items="${values}" var="v">
						<c-rt:set var="pv" value="${pu:addToList('ps', pu:toLong(v))}"/>
					</c-rt:forEach>
					${pu:criteriaForName('com.yaodian100.crm.cs.entity.MustInquire') }
					${pu:criteriaAdd(pu:criteriaIn('id', pv))}
					<c-rt:set var="mis" value="${pu:criteriaResult(null)}"/>
					<c-rt:forEach items="${mis}" var="mi">
						${mi.description }<br/>
					</c-rt:forEach>
			</c-rt:if>
        </td>
        <td align="left"><b>来源：</b>${pu:get('com.yaodian100.crm.cs.entity.FromChannel', question.channel.id).title}</td>
        <td align="left"><b>问题单类型:</b>${question.type.description }</td>
      </tr>
      <tr>
        <td height="30" align="left"><b>短描述：</b>${question.shortDesc}</td>
        <td align="left"><b>问题说明：</b>${question.description}</td>
        <td colspan="2" align="left"><b>前单说明：</b>${workOrder.comment }</td>
        </tr>
      <tr>
        <td height="30" colspan="4" align="left" valign="top"><b>建立人／建立时间：</b>
        
        			${pu:reqSet('createUser', pu:get('com.yaodian100.core.admin.entity.User', workOrder.createUser)) }
					
					${createUser.group.description }-${workOrder.createUser }/<fmt-rt:formatDate value="${workOrder.createDate}" pattern="yyyy-MM-dd HH:mm"/>
					
					
					<b>处理时效：</b>${pu:subDateInHour(workOrder.finishTime, workOrder.startTime) }
					</td>
        </tr>
      <tr>
        <td height="30" colspan="4" align="left" valign="top"><b>工单状态：</b>
        
          ${pu:menuOption('WorkOrder.status', pu:toString(workOrder.status)).name }
          <c-rt:if test="${workOrder.status=='2'}">
          <b>结单方式：</b>
          <c-rt:if test="${empty workOrder.finishType || workOrder.finishType=='1'}">
          自行结单
          </c-rt:if>
          <c-rt:if test="${workOrder.finishType=='2'}">
          移转
          </c-rt:if>
          <c-rt:if test="${workOrder.finishType=='3'}">
          代结
          </c-rt:if>
          </c-rt:if>
          </td>
        </tr>
      <tr>
        <td height="30" colspan="4" align="left" valign="top"><b>审核状态：</b>
        
        ${pu:listAdd('approvesPara', workOrder.id) }
        ${pu:reqSet('approves', pu:queryByHql('from WorkOrderApprove where workOrderId=? order by startDate desc', pu:arrayGet('approvesPara'), null)) }
        ${pu:reqSet('apSize', 0) }
        <c-rt:forEach items="${approves }" var="approve" varStatus="status">
        ${pu:reqSet('apSize', status.count) }
        </c-rt:forEach>
       <c-rt:if test="${apSize==0}">
       	<c-rt:if test="${workOrder.approveStatus==0}">
        <c-rt:if test="${workOrder.status==1}">
        回覆待审核：
        ${pu:reqSet('aList', null) }
        ${pu:listAdd('aList', workOrder.domainId) }
        ${pu:listAdd('aList', pu:toBoolean('true')) }
        ${pu:reqSet('answers', pu:queryByHql('from Answer a where a.question.id=? and a.isApproved!=?', pu:arrayGet('aList'), null)) }
        <c-rt:forEach items="${answers }" var="answer">
        ${answer.content }
        </c-rt:forEach>
        </c-rt:if>
        <c-rt:if test="${workOrder.approveStatus==0 && workOrder.status==0}">
        待审核
        </c-rt:if>
        <c-rt:if test="${workOrder.approveStatus==0 && workOrder.status==3}">
        待审核
        转单至：${pu:get('com.yaodian100.core.admin.entity.Group', workOrder.responseGroup).description}(${workOrder.responseGroup })
        </c-rt:if>
        </c-rt:if>
        <c-rt:if test="${workOrder.approveStatus==1}">
        已核可
        </c-rt:if>
        <c-rt:if test="${workOrder.approveStatus==2}">
        已注销
        </c-rt:if>
        <b>审核人：</b>${workOrder.approver }/<c-rt:if test="${!empty workOrder.approveGroup}">${pu:get('com.yaodian100.core.admin.entity.Group', workOrder.approveGroup).description}</c-rt:if>
       <c-rt:if test="${!empty workOrder.approveTime}">
       <b>审核开始时间：</b><fmt-rt:formatDate value="${workOrder.approveTime}" pattern="yyyy-MM-dd HH:mm"/> 审核完成时间：<fmt-rt:formatDate value="${workOrder.approveTime}" pattern="yyyy-MM-dd HH:mm"/>
       </c-rt:if>
       </c-rt:if>
       <c-rt:if test="${apSize>0}">
        <c-rt:forEach items="${approves}" var="app">
        	<c-rt:if test="${workOrder.approveStatus==0}">
        <c-rt:if test="${workOrder.status==1}">
        回覆待审核：
        ${pu:reqSet('aList', null) }
        ${pu:listAdd('aList', workOrder.domainId) }
        ${pu:listAdd('aList', pu:toBoolean('true')) }
        ${pu:reqSet('answers', pu:queryByHql('from Answer a where a.question.id=? and a.isApproved!=?', pu:arrayGet('aList'), null)) }
        <c-rt:forEach items="${answers }" var="answer">
        ${answer.content }
        </c-rt:forEach>
        </c-rt:if>
        <c-rt:if test="${workOrder.approveStatus==0 && workOrder.status==3}">
        待审核
        转单至：${pu:get('com.yaodian100.crm.cs.entity.TaskGroup', workOrder.responseGroup).description}(${workOrder.responseGroup })
        </c-rt:if>
        </c-rt:if>
        <c-rt:if test="${app.approveStatus==1}">
        已核可
        </c-rt:if>
        <c-rt:if test="${app.approveStatus==2}">
        已注销
        </c-rt:if>
        <b>审核人：</b>${app.approver }/<c-rt:if test="${!empty app.approver}">
        ${pu:reqSet('agPara', null) }
		${pu:listAdd('agPara', user.username) }
		${pu:listAdd('agPara', true) }
        ${pu:reqSet('approveGroup', pu:queryByHql('from TaskGroupUser where user.username=? and defaultGroup=?', pu:arrayGet('agPara'), null)) }
        <c-rt:if test="${!empty approveGroup}">
        	${approveGroup[0].taskGroup.name }
        </c-rt:if>
        </c-rt:if>
       
       <b>审核开始时间：</b><fmt-rt:formatDate value="${approve.startDate}" pattern="yyyy-MM-dd HH:mm"/> 审核完成时间<fmt-rt:formatDate value="${workOrder.approveTime}" pattern="yyyy-MM-dd HH:mm"/>
       <br/>
        </c-rt:forEach>
     </c-rt:if>
        </td>
      </tr>
      <tr>
      <td  height="30" colspan="4" align="left" valign="top">
      <b>处理人：</b>
      ${workOrder.owner.username}/<c-rt:if test="${!empty workOrder.responseGroup}">
					${pu:get('com.yaodian100.core.admin.entity.Group', workOrder.responseGroup).description }(${workOrder.responseGroup })
					</c-rt:if>
					
		<c-rt:if test="${!empty workOrder.finishTime}">			
		<b>完成时间：</b><fmt-rt:formatDate value="${workOrder.finishTime}" pattern="yyyy-MM-dd HH:mm"/>
		</c-rt:if>
      </td>
      </tr>
      <tr>
      <td colspan="4">
      主商品线：
      <c-rt:if test="${!empty workOrder.question.category}">
      ${pu:reqSet('category', pu:get('com.yaodian100.ec.category.entity.Category', pu:toLong(workOrder.question.category))) }
      ${category.name }(${workOrder.question.category })
      </c-rt:if>
      配送商：
      <c-rt:if test="${!empty workOrder.question.deliver}">
      ${pu:reqSet('deliver', pu:get('com.yaodian100.crm.workorder.entity.LogisticProvider', workOrder.question.deliver)) }
      ${deliver.name }(${workOrder.question.deliver })
      </c-rt:if>
      
      </td>
      </tr>
      <tr>
      <td colspan="4" >
      <b>其他资讯：</b>
      ${pu:reqSet('evCount', 0) }
      <c-rt:forEach items="${workOrder.question.extraValue}" var="valuePair" varStatus="evIndex">
      <c-rt:if test="${!empty valuePair.value.value}">
      <c-rt:if test="${evCount>0}">
      , 
      </c-rt:if>
      ${valuePair.value.attribute.description }:
      <c-rt:choose>
      <c-rt:when test="${valuePair.value.name=='class1' || valuePair.value.name=='class2' || valuePair.value.name=='commonQuestionType'}">
      <c-rt:set var="cqt" value="${pu:get('com.yaodian100.crm.cs.entity.CommonQuestionType', valuePair.value.value)}"/>
      ${cqt.name }
      </c-rt:when>
      <c-rt:otherwise> 
      ${valuePair.value.value }
      </c-rt:otherwise>
      </c-rt:choose>
      <c-rt:set var="evCount" value="${evCount+1}"/>
      </c-rt:if>
      
      </c-rt:forEach>
      
      </td>
      </tr>
        

    </table>
    <table width="100%" border="1" cellpadding="0" cellspacing="0"  class="tb-data">
      <tr>
        <td><b>邮箱：</b>${question.email}</td>
        <td><b>手机：</b>${question.extraValue['cellPhone'].value}</td>
        <td><b>固定电话： </b>${question.extraValue['phoneArea'].value} ${question.extraValue['phone'].value} <c-rt:if test="${!empty question.extraValue['phoneExt'].value}">分机${question.extraValue['phoneExt'].value}</c-rt:if></td>
      </tr>
    </table>
    
    <c-rt:if test="${workOrder.status==1 && workOrder.approveStatus==2 && pu:username()==workOrder.owner.username}">
    <%--更新回覆 --%>
    ${pu:listAdd('apList', question.id) }
    ${pu:listAdd('apList', pu:toBoolean('true')) }
    ${pu:reqSet('notApprovedAnswers', pu:queryByHql('from Answer a where a.question.id=? and a.isApproved!=?', pu:arrayGet('apList'), null)) }
    <form name="updateAnswerForm">
    <table width="100%" border="1" cellpadding="0" cellspacing="0"  class="tb-data">
      <tr>
      	<td>注销原因：</td><td><span style="color: red">${workOrder.approveComment }</span></td>
      </tr>
      
	<c-rt:if test="${pu:substring(user.group.code, 0, 1)=='C'}">
      <c-rt:if test="${!empty question.extraValue['productId'].value || !empty member.memberId}">
      <tr>
        <td width="250"><b>回复<BR/>[回复会员，这是给客人的信息，客人将可看到此内容。若没有任何要给客人的信息，请不要填此栏！]：</b></td><td>
        <input type="hidden" name="workOrderId" value="${workOrder.id }"/>
        <input type="hidden" name="answerId" value="${notApprovedAnswers[0].id }"/>
        <textarea name="content" cols="50" rows="5">${notApprovedAnswers[0].content}</textarea></td>
 
      </tr>
      </c-rt:if>
      </c-rt:if>
      <tr>
      	<td></td><td><input type="button" value="更新回复" onclick="updateAnswer()"/></td>
      </tr>
    </table>
    </form>
    <script>
    function updateAnswer(){
		if(document.updateAnswerForm.content.value==''){
			alert('请输入回复');
		}else{
			doAR('<%=application.getContextPath() %>/workOrder/updateAnswer.do', 'main', 'updateAnswerForm');
		}
    }
    </script>
    </c-rt:if>
    
<!-- 审核 -->
<c-rt:if test="${!empty workOrder.node.approveGroup}">
${pu:listAdd('approveUserPara', user.username) }
${pu:listAdd('approveUserPara', workOrder.node.approveGroup) }
${pu:reqSet('nodeApproveUser', pu:queryByHql('from TaskGroupUser where user.username=? and taskGroup.id=?', pu:arrayGet('approveUserPara'), null)) }
</c-rt:if>
<c-rt:if test="${!empty workOrder.approveGroup}">
${pu:reqSet('approveUserPara', null) }
${pu:listAdd('approveUserPara', user.username) }
${pu:listAdd('approveUserPara', workOrder.approveGroup) }
${pu:reqSet('approveUser', pu:queryByHql('from TaskGroupUser where user.username=? and taskGroup.id=?', pu:arrayGet('approveUserPara'), null)) }
</c-rt:if>

    <c-rt:if test="${(workOrder.approver==pu:username() || !empty nodeApproveUser || !empty approveUser) && workOrder.approveStatus==0 && workOrder.status!='9'}">

            
<form name="approveForm" method="post">
		<input type="hidden" name="id" value="${workOrder.id }"/>
		<table class="tb-data" >
		<tr><th>审核意见</th><td><textarea name="approveComment" id="theComment" rows="10" cols="50"></textarea></td></tr>
		<tr><th></th><td>
		<input type="button" value="核可" onclick="doAR('<%=application.getContextPath() %>/workOrder/approveOrder.do', 'main', 'approveForm')"/> 
		<input type="button" value="注销" onclick="doAR('<%=application.getContextPath() %>/workOrder/rejectOrder.do', 'main', 'approveForm')"/>

		<input type="reset" value="重设"/>
		</td>
		</tr>
		</table>
		</form>

</c-rt:if>
    <!-- 问题单回覆 -->
	<c-rt:if test="${workOrder.owner.username==pu:username() && question.type.needAnswer && (workOrder.status==0 || workOrder.status==4)}">
<form name="answerForm" method="post">
<input type="hidden" name="id" value="${question.id }"/>
<input type="hidden" name="workOrderId" value="${workOrder.id }"/>
<table class="tb-data" style="width:100%">
<tr>
<th>处理等级</th>
<td>
<select name="endPriority">
<option value="0" <c-rt:if test="${workOrder.priority==0 }">selected="selected"</c-rt:if>>函件</option>
<option value="1" <c-rt:if test="${workOrder.priority==1 }">selected="selected"</c-rt:if>>普通件</option>
<option value="2" <c-rt:if test="${workOrder.priority==2 }">selected="selected"</c-rt:if>>急件</option>
<option value="3" <c-rt:if test="${workOrder.priority==3 }">selected="selected"</c-rt:if>>特急件</option>
</select>
</td>
</tr>

<tr>
<th>问题分类</th>
<td>
<script>
$(function(){
	doAR('/ecadmin/cs/page.do?iamlazy=cqTypeList&class1=${workOrder.question.extraValue['class1'].value}&theForm=answerForm', 'class1Zone');
	doAR('/ecadmin/cs/page.do?iamlazy=subTypeList&class2=${workOrder.question.extraValue['class2'].value}&parentId=${workOrder.question.extraValue['class1'].value}&theForm=answerForm', 'class2Zone');
	doAR('/ecadmin/cs/page.do?iamlazy=level3List&commonQuestionType=${workOrder.question.extraValue['commonQuestionType'].value}&parentId=${workOrder.question.extraValue['class2'].value}&theForm=answerForm', 'commonQuestionTypeZone');
});
</script>
<table><tr><td>
问题大类：</td><td><div id="class1Zone"></div></td><td>
问题中类：</td><td><div id="class2Zone"></div></td><td>
问题小类：</td><td><div id="commonQuestionTypeZone"></div>
</td></tr></table>
</td>
</tr>

<tr>
        <th>工单备注<BR/>[内部沟通使用]</th>
        <td colspan="3">
        <textarea name="note" cols="50" rows="5"></textarea>
        </td>
        
        </tr>
        <c-rt:if test="${pu:substring(user.group.code, 0, 1)=='C'}">
        <c-rt:if test="${!empty question.extraValue['productId'].value || !empty member.memberId}">
	<tr>
	<th  width="250">回复<BR/>[回复会员，这是给客人的信息，客人将可看到此内容。若没有任何要给客人的信息，请不要填此栏！]</th><td>
	<textarea name="answer" cols="50" rows="5"></textarea>
	</td>
	</tr>
	</c-rt:if>
	</c-rt:if>
	<c-rt:if test="${question.channel.title=='WEB form'}">
	<tr>
	<th>将回复显示在商品页</th><td>
	<input type="radio" name="showOnProductPage" value="true"/>是<input type="radio" name="showOnProductPage" value="false" checked="checked"/>否
	</td>
	</tr>
    
	</c-rt:if>
	<tr>
	<th></th>
	<td>
	${pu:reqSet('actsList', null) }
	<c-rt:if test="${!empty workOrder.node}">
	${pu:listAdd('actsList', workOrder.node.id) }
	${pu:reqSet('acts', pu:queryByHql('from WorkFlowNodeAct where node.id=?', pu:arrayGet('actsList'), null)) }
	<c-rt:forEach items="${acts}" var="act">
		<input type="button" value="${act.attr.description }" onclick="closeOrder('${act.attr.componentUrl}')"/>
	</c-rt:forEach>
	</c-rt:if>
	<span class="buttons">
	<input type="button" value="结单" onclick="closeOrder('/ecadmin/workOrder/closeOrder.do')"/>
	<input type="reset" value="重置"/>
	</span>
	</td>
	</tr>
  </table>
  </form>
        </c-rt:if>
    
    <!-- 工单回覆 -->
        <c-rt:if test="${(workOrder.owner.username==pu:username() && !question.type.needAnswer && (workOrder.status==0 || workOrder.status==4))}">
        <form name="answerForm" method="post">
<input type="hidden" name="id" value="${question.id }"/>
<input type="hidden" name="workOrderId" value="${workOrder.id }"/>
<input type="hidden" name="returnId" value="${question.extraValue['returnId'].value }"/>
        <table class="tb-data" style="width:100%">
        <tr>
<th>处理等级</th>
<td>
<select name="endPriority">
<option value="0" <c-rt:if test="${workOrder.priority==0 }">selected="selected"</c-rt:if>>函件</option>
<option value="1" <c-rt:if test="${workOrder.priority==1 }">selected="selected"</c-rt:if>>普通件</option>
<option value="2" <c-rt:if test="${workOrder.priority==2 }">selected="selected"</c-rt:if>>急件</option>
<option value="3" <c-rt:if test="${workOrder.priority==3 }">selected="selected"</c-rt:if>>特急件</option>
</select>
</td>
</tr>
<tr>
<th>问题分类</th>
<td>
<script>
$(function(){
	doAR('/ecadmin/cs/page.do?iamlazy=cqTypeList&class1=${workOrder.question.extraValue['class1'].value}&theForm=answerForm', 'class1Zone');
	doAR('/ecadmin/cs/page.do?iamlazy=subTypeList&class2=${workOrder.question.extraValue['class2'].value}&parentId=${workOrder.question.extraValue['class1'].value}&theForm=answerForm', 'class2Zone');
	doAR('/ecadmin/cs/page.do?iamlazy=level3List&commonQuestionType=${workOrder.question.extraValue['commonQuestionType'].value}&parentId=${workOrder.question.extraValue['class2'].value}&theForm=answerForm', 'commonQuestionTypeZone');
});
</script>
<table><tr><td>
问题大类：</td><td><div id="class1Zone"></div></td><td>
问题中类：</td><td><div id="class2Zone"></div></td><td>
问题小类：</td><td><div id="commonQuestionTypeZone"></div>
</td></tr></table>
</td>
</tr>
        <tr>
        <th>工单备注<BR/>[内部沟通使用]</th>
        <td colspan="3">
        <textarea name="note" cols="50" rows="5"></textarea>
        </td>
        
        </tr>
        <tr>
	<th></th>
	<td>
	<span class="buttons">
	<c-rt:choose>
	<c-rt:when test="${question.type.name!='ReturnProductApply' || (question.type.name=='ReturnProductApply' && workOrder.node.workFlow.mustReturnMaster && !empty workOrder.parent)}">
	${pu:reqSet('actsList', null) }
	<c-rt:if test="${!empty workOrder.node}">
	${pu:listAdd('actsList', workOrder.node.id) }
	${pu:reqSet('acts', pu:queryByHql('from WorkFlowNodeAct where node.id=?', pu:arrayGet('actsList'), null)) }
	<c-rt:forEach items="${acts}" var="act">
		<input type="button" value="${act.attr.description }" onclick="closeOrder('${act.attr.componentUrl}')"/>
	</c-rt:forEach>
	</c-rt:if>
	<input type="button" value="结单" onclick="doAR('<%=application.getContextPath() %>/workOrder/closeOrder.do', 'main', 'answerForm')"/>
	<input type="reset" value="重置"/>
	</c-rt:when>
	<c-rt:otherwise>
	<input type="button" value="结单并确认退货" onclick="doAR('<%=application.getContextPath() %>/workOrder/confirmReturnProductApply.do', 'main', 'answerForm')"/>
	<input type="button" value="结单并取消退货" onclick="doAR('<%=application.getContextPath() %>/workOrder/cancelReturnProductApply.do', 'main', 'answerForm')"/>
	<input type="button" value="结单(已确认转换货)" onclick="closeOrder()"/>
	<input type="reset" value="重置"/>
	</c-rt:otherwise>
	</c-rt:choose>
	</span>
	</td>
	</tr>
        </table>
        </form>
        </c-rt:if>
    
	</div>
    <c-rt:if test="${!empty question.extraValue['orderId'].value}">
   
	<div id="orderDetail">
    <a href="<c-rt:url value="/order/popView.do?orderId=${question.extraValue['orderId'].value }"/>" target="_blank">跳出订单明细页</a>
	</div>
	</c-rt:if>
	<c-rt:if test="${!empty question.extraValue['returnId'].value}">
	<div id="returnProductDetail">
	<a href="<c-rt:url value="/serviceOrder/page.do?iamlazy=detail&fromWorkOrder=true&serviceId=${question.extraValue['returnId'].value }"/>" target="_blank">跳出退货单明细</a>
	<%--
<jsp:include page="/WEB-INF/jsp/order/returnProductInfo.jsp"/>
	--%>
	</div>
    </c-rt:if>
    <c-rt:if test="${!empty question.extraValue['changeId'].value}">
    <div id="changeProductDetail">
    <a href="<c-rt:url value="/serviceOrder/page.do?iamlazy=detail&serviceId=${question.extraValue['changeId'].value }"/>" target="_blank">跳出换货单明细</a>
    <%--
<jsp:include page="/WEB-INF/jsp/order/changeProductInfo.jsp"/>
	--%>
	</div>
    </c-rt:if>
    <c-rt:if test="${!empty question.extraValue['productId'].value}">
    <div id="productDetail">
<a href="<%=ServerValue.getFrontHostname()+ServerValue.getFrontContextPath() %>/product/product.do?productId=${question.extraValue['productId'].value}" target="_blank">跳出前台商品页面</a>
	</div>
	</c-rt:if>
	<c-rt:if test="${workOrder.owner.username==pu:username()&& workOrder.status!=3 && workOrder.status!=2 && workOrder.approveStatus!=0 && workOrder.status!=1}">
    <div id="forwardOrder">
    
    <form name="theForm" method="post">
    	<input type="hidden" name="fromManage" value="${param.fromManage }"/>
		<input type="hidden" name="questionType" value="${question.type.name}"/>
		<%--
		<input type="hidden" name="workOrderId" value="${workOrder.id }"/>
		--%>
		<input type="hidden" name="id" value="${workOrder.id }"/>
		<table class="tb-data" >
		<tr><th>处理等级</th><td>
			<select name="priority">
				<option value="0">函件</option>
				<option value="1">一般件</option>
				<option value="2">急件</option>
				<option value="3">特急件</option>
			</select>
		</td></tr>
		
		<tr><th>问题分类</th><td>
			<c-rt:if test="${empty workOrder.node}">
				<script>
					$(function(){
						
						doAR('${question.extraValue["class1"].attribute.componentUrl}&class1=${question.extraValue["class1"].value}&questionId=${question.id}&workFlowNodeId=${workOrder.node.id}&allowBackward=${workOrder.node.allowBackward}&parentWorkOrderNodeId=${workOrder.parent.node.id}&zonePostfix=N&setCompensation=Y', 'class1ZoneN');
					});
				</script>


				<script>
					$(function(){
						doAR('${question.extraValue["class2"].attribute.componentUrl}&class2=${question.extraValue["class2"].value}&parentId=${question.extraValue["class1"].value}&workFlowNodeId=${workOrder.node.id}&allowBackward=${workOrder.node.allowBackward}&parentWorkOrderNodeId=${workOrder.parent.node.id}&zonePostfix=N', 'class2ZoneN');
					});
				</script>
			
				<script>
					$(function(){
						doAR('${question.extraValue["commonQuestionType"].attribute.componentUrl}&commonQuestionType=${question.extraValue["commonQuestionType"].value}&parentId=${question.extraValue["class2"].value}&workFlowNodeId=${workOrder.node.id}&allowBackward=${workOrder.node.allowBackward}&parentWorkOrderNodeId=${workOrder.parent.node.id}&zonePostfix=N', 'commonQuestionTypeZoneN');
						doAR('<%=application.getContextPath() %>/cs/page.do?iamlazy=forwardOrderZone&cqtId=${question.extraValue["commonQuestionType"].value}&workFlowNodeId=${workOrder.node.id}&allowBackward=${workOrder.node.allowBackward}&parentWorkOrderNodeId=${workOrder.parent.node.id}', 'forwardOrderZoneN');
					});
				</script>
				
				<span id="class1ZoneN">
				<select name="class1">
					
						<option value="${question.extraValue['class1'].value}">${question.extraValue['class1'].attribute.name}</option>
					
				</select>
				
				</span>
				<span id="class2ZoneN">
				<select name="class2" >
					
						<option value="${question.extraValue['class2'].value}">${question.extraValue['class2'].attribute.name}</option>
					
				</select>
				</span>
				<span id="commonQuestionTypeZoneN">
				<select name="commonQuestionType" >
					
						<option value="${question.extraValue['commonQuestionType'].value}">${question.extraValue['commonQuestionType'].attribute.name}</option>
					
				</select>
				
				</span>
				</c-rt:if>
				<c-rt:if test="${!empty workOrder.node}">
				<c-rt:if test="${!empty question.extraValue['class1'].value}">
        <c-rt:set var="cqt" value="${pu:get('com.yaodian100.crm.cs.entity.CommonQuestionType', question.extraValue['class1'].value)}"/>
        		<input type="hidden" name="class1" value="${question.extraValue['class1'].value}"/>
				${cqt.name} /
                </c-rt:if>
                <c-rt:if test="${!empty question.extraValue['class2'].value}">
        <c-rt:set var="cqt" value="${pu:get('com.yaodian100.crm.cs.entity.CommonQuestionType', question.extraValue['class2'].value)}"/>
        		<input type="hidden" name="class2" value="${question.extraValue['class2'].value}"/>
				${cqt.name} /
                </c-rt:if>
                <c-rt:if test="${!empty question.extraValue['commonQuestionType'].value}">
        <c-rt:set var="cqt" value="${pu:get('com.yaodian100.crm.cs.entity.CommonQuestionType', question.extraValue['commonQuestionType'].value)}"/>
        		<input type="hidden" name="commonQuestionType" value="${question.extraValue['commonQuestionType'].value}"/>
		  ${cqt.name} </c-rt:if>
				</c-rt:if>
		</td></tr>
		<tr><th>必问问题</th><td>
				<c-rt:if test="${empty workOrder.node}">
				<script>
					$(function(){
						doAR("${question.extraValue['mustInquire'].attribute.componentUrl}&cqtId=${question.extraValue['commonQuestionType'].value}&mustInquire=${question.extraValue['mustInquire'].value}", 'mustInquireZoneN');
					});
				</script>

				<span id="mustInquireZoneN">
				
				</span>
				</c-rt:if>
				<c-rt:if test="${!empty workOrder.node}">
				<c-rt:if test="${!empty question.extraValue['mustInquire'].value}">
					<c-rt:set var="values" value="${pu:split(question.extraValue['mustInquire'].value, ',')}"/>
					<c-rt:forEach items="${values}" var="v">
						<c-rt:set var="pv" value="${pu:addToList('ps', pu:toLong(v))}"/>
					</c-rt:forEach>
					${pu:criteriaForName('com.yaodian100.crm.cs.entity.MustInquire') }
					${pu:criteriaAdd(pu:criteriaIn('id', pv))}
					<c-rt:set var="mis" value="${pu:criteriaResult(null)}"/>
					<c-rt:forEach items="${mis}" var="mi">
						${mi.description }<br/>
					</c-rt:forEach>
			</c-rt:if>
				</c-rt:if>
		</td></tr>
		
		<tr id="compensationArea" style="display:none">
			<th>补偿</th>
			<td colspan="3">
				<textarea name="compensation" cols="150" rows="3"></textarea>
			</td>
		</tr>
		<tr><th>备注<BR/>[内部沟通使用]</th><td>
		<textarea name="comment" id="theComment" rows="10" cols="50"></textarea>
		</td></tr>
		<c-rt:if test="${pu:substring(user.group.code, 0, 1)=='C'}">
		<c-rt:if test="${!empty question.extraValue['productId'].value || !empty member.memberId}">
		<tr>
	<th  width="250">回复<BR/>[回复会员，这是给客人的信息，客人将可看到此内容。若没有任何要给客人的信息，请不要填此栏！]</th><td>
	<textarea name="answer" cols="50" rows="5"></textarea>
	</td>
	</tr>
	</c-rt:if>
	</c-rt:if>
	<c-rt:if test="${question.channel.title=='WEB form'}">
	<tr>
	<th>将回复显示在商品页</th><td>
	<input type="radio" name="showOnProductPage" value="true"/>是<input type="radio" name="showOnProductPage" value="false" checked="checked"/>否
	</td>
	</tr>
    
	</c-rt:if>
		
		<tr><th></th><td id="forwardOrderZoneN">
		<c-rt:if test="${question.type.name!='CommonQuestion' && empty workOrder.node}">
		<c-rt:set var="paramsWF" value="${pu:addToList('parasWF', question.type.workFlowName)}"/>
			<c-rt:set var="hqlWF">
			from WorkFlowNode where workFlow.name=? and parent is null
			</c-rt:set>
			<c-rt:set var="workFlowNodes" value="${pu:queryByHql(hqlWF, paramsWF, null)}"/>
			<c-rt:if test="${empty workFlowNodes}">
			无法转单
			</c-rt:if>
			<c-rt:forEach items="${workFlowNodes}" var="workFlowNode">
			<input type="button" value="${workFlowNode.shortDesc }"  onclick="submitForwardForm(1, '${workFlowNode.responser}', '${workFlowNode.id}')"/>
			</c-rt:forEach>
		</c-rt:if>
		<c-rt:if test="${!empty workOrder.node}">
		<c-rt:set var="workFlowNode" value="${pu:get('com.yaodian100.crm.workflow.entity.WorkFlowNode', workOrder.node.id)}"/>
		<c-rt:if test="${workOrder.node.allowBackward=='true'}">
		<input type="button" value="回单"  onclick="submitForwardForm(2, '${workOrder.parent.owner.username}', '${workOrder.parent.node.id}')"/>
		</c-rt:if>
		<c-rt:set var="workFlowNodes" value="${workFlowNode.childs}"/>
		<c-rt:if test="${empty workFlowNodes}">
			无法转单
			</c-rt:if>
			<c-rt:forEach items="${workFlowNodes}" var="workFlowNode">
			<input type="button" value="${workFlowNode.shortDesc }"  onclick="submitForwardForm(1, '${workFlowNode.responser}', '${workFlowNode.id}')"/>
			</c-rt:forEach>
		</c-rt:if>
		<!-- 
		<input type="button" value="转单" onclick="doAR('','main', 'forwardForm');closeDialog()"/>
		<input type="reset" value="重设"/>
		 -->
		</td>
		</tr>
		</table>
	</form>
    <%-- 
    <c-rt:if test="${question.type.name=='CommonQuestion' && !empty question.extraValue['commonQuestionType'].value}">
		<c-rt:set var="cqt" value="${pu:get('com.yaodian100.crm.cs.entity.CommonQuestionType', question.extraValue['commonQuestionType'].value) }"/>
			<c-rt:set var="workFlowName" value="${cqt.workFlowName}"/>

	</c-rt:if>
	<c-rt:if test="${question.type.name!='CommonQuestion'}">
		<c-rt:set var="workFlowName" value="${question.type.workFlowName}"/>
	</c-rt:if>
	<c-rt:if test="${!empty workFlowName}">
		<c-rt:if test="${empty workOrder.node}">
			<c-rt:set var="paramsForward" value="${pu:addToList('parasForward', workFlowName)}"/>
			<c-rt:set var="hql">
			from WorkFlowNode where workFlow.name=? and parent is null
			</c-rt:set>
			<c-rt:set var="workFlowNodes" value="${pu:queryByHql(hql, paramsForward, null)}"/>
			<c-rt:if test="${empty workFlowNodes}">
			无法转单
			</c-rt:if>
			<c-rt:forEach items="${workFlowNodes}" var="workFlowNode">
			<input type="button" onclick="openDialog('转单', buildForwardForm(1,'${workOrder.id}', '${workFlowNode.id }', '${workFlowNode.responser }', '${workFlowNode.shortDesc }'), 500,400)" value="${workFlowNode.shortDesc }"/>
			</c-rt:forEach>
		</c-rt:if>
		<c-rt:if test="${!empty workOrder.node}">
			<c-rt:if test="${workOrder.node.allowBackward}">
			<input type="button" onclick="openDialog('转单', buildForwardForm(2,'${workOrder.id}', '${workOrder.parent.node.id }', '${workOrder.parent.node.responser }', '退回'), 500,400)" value="回上一层"/>
			</c-rt:if>
			<c-rt:set var="params" value="${pu:addToList('paras', workOrder.node.id)}"/>
			<c-rt:set var="hql">
			from WorkFlowNode where parent.id=?
			</c-rt:set>
			<c-rt:set var="workFlowNodes" value="${pu:queryByHql(hql, params, null)}"/>
			<c-rt:if test="${empty workFlowNodes}">
			无法转单
			</c-rt:if>
			<c-rt:forEach items="${workFlowNodes}" var="workFlowNode">
			<input type="button" onclick="openDialog('转单', buildForwardForm(1,'${workOrder.id}', '${workFlowNode.id }', '${workFlowNode.responser }', '${workFlowNode.shortDesc }'), 500,400)" value="${workFlowNode.shortDesc }"/></a>
			</c-rt:forEach>
		</c-rt:if>
	</c-rt:if>
	--%>
    </div>
    </c-rt:if>
   <c-rt:if test="${workOrder.status==2}">
    <div id="replyDetail">
    <table width="100%" border="1" cellspacing="0" cellpadding="0" class="tb-data">
    	<tr>
    		<td width="150"><b>前单說明 </b></td><td>${workOrder.comment }</td>
    	</tr>
    	<tr>
    		<td width="150"><b>工单备注[内部沟通使用] </b></td><td>${workOrder.note }</td>
    	</tr>
    	<c-rt:if test="${!empty question.extraValue['productId'].value || !empty member.memberId}">
    	<tr>
    		<td valign="top" width="250"><b>回复[回复会员，这是给客人的信息，客人将可看到此内容。若没有任何要给客人的信息，请不要填此栏！] </b></td><td>
    		<table>
			<c-rt:forEach items="${question.answers}" var="answer">
			<tr><td style="border-bottom:1px solid #999">${answer.content }</td></tr>
			</c-rt:forEach>
			</table>		
			</td>
    	</tr>
    	
    	</c-rt:if>
    	<tr>
    	<td>处理等级</td>
    	<td>
    	<c-rt:if test="${empty workOrder.endPriority or workOrder.endPriority==0}">
    	函件
    	</c-rt:if>
    	<c-rt:if test="${workOrder.endPriority==1}">
    	普通件
    	</c-rt:if>
    	<c-rt:if test="${workOrder.endPriority==2}">
    	急件
    	</c-rt:if>
    	<c-rt:if test="${workOrder.endPriority==3}">
    	特急件
    	</c-rt:if>
    	</td>
    	</tr>
    	<tr>
    	<td>问题分类</td>
    	<td>
    	 <c-rt:if test="${!empty workOrder.endClass1}">
        <c-rt:set var="cqt" value="${pu:get('com.yaodian100.crm.cs.entity.CommonQuestionType', workOrder.endClass1)}"/>
				${cqt.name} /
                </c-rt:if>
                <c-rt:if test="${!empty workOrder.endClass2}">
        <c-rt:set var="cqt" value="${pu:get('com.yaodian100.crm.cs.entity.CommonQuestionType', workOrder.endClass2)}"/>
				${cqt.name} /
                </c-rt:if>
                <c-rt:if test="${!empty workOrder.endClass3}">
        <c-rt:set var="cqt" value="${pu:get('com.yaodian100.crm.cs.entity.CommonQuestionType', workOrder.endClass3)}"/>
		  ${cqt.name} </c-rt:if>
    	
    	</td>
    	</tr>
    	
    </table>
    ${pu:reqSet('workOrderSql', 'from WorkOrder where domainId=? order by createDate desc') }
    ${pu:listAdd('workOrderSqlList', workOrder.domainId) }
    ${pu:reqSet('workOrders',pu:queryByHql(workOrderSql, pu:arrayGet('workOrderSqlList'), null)) }
    
    <a id="moreWoA" href="javascript:void(0)">更多回覆内容</a>
    <div id="moreWo" style="display:none">
    <c-rt:forEach items="${workOrders}" var="wo">
    <table width="100%" border="1" cellspacing="0" cellpadding="0" class="tb-data">
   		<tr>
    		<td width="150"><b>工单编号／工单状态／处理人／完成时间 </b></td><td>${wo.id }／${pu:menuOption('WorkOrder.status', pu:toString(wo.status)).name }／${wo.owner.username }／<fmt-rt:formatDate value="${wo.finishTime}" pattern="yyyy-MM-dd HH:mm"/></td>
    	</tr>
    	<tr>
    		<td width="150"><b>前单說明 </b></td><td>${wo.comment }</td>
    	</tr>
    	<tr>
    		<td width="150"><b>工单备注[内部沟通使用] </b></td><td>${wo.note }</td>
    	</tr>
    	<c-rt:if test="${!empty wo.question.extraValue['productId'].value || !empty member.memberId}">
    	<tr>
    		<td valign="top" width="250"><b>回复[回复会员，这是给客人的信息，客人将可看到此内容。若没有任何要给客人的信息，请不要填此栏！] </b></td><td>
    		<table>
    		${pu:reqSet('woAnswerList', null) }
    		${pu:listAdd('woAnswerList', wo.id) }
    		${pu:reqSet('woAnswer', pu:queryByHql('from Answer where workOrder.id=?', pu:arrayGet('woAnswerList'), null)[0])}
			<c-rt:if test="${!empty woAnswer}">
			<tr><td style="border-bottom:1px solid #999">${theAnswer.content }</td></tr>
			</c-rt:if>
			</table>		
			</td>
    	</tr>
    	
    	</c-rt:if>
    	<c-rt:if test="${wo.status==2}">
    	<tr>
    	<td>处理等级</td>
    	<td>
    	<c-rt:if test="${empty wo.endPriority or wo.endPriority==0}">
    	函件
    	</c-rt:if>
    	<c-rt:if test="${wo.endPriority==1}">
    	普通件
    	</c-rt:if>
    	<c-rt:if test="${wo.endPriority==2}">
    	急件
    	</c-rt:if>
    	<c-rt:if test="${wo.endPriority==3}">
    	特急件
    	</c-rt:if>
    	</td>
    	</tr>
    	
    	<tr>
    	<td>问题分类</td>
    	<td>
    	 <c-rt:if test="${!empty wo.endClass1}">
        <c-rt:set var="cqt" value="${pu:get('com.yaodian100.crm.cs.entity.CommonQuestionType', wo.endClass1)}"/>
				${cqt.name} /
                </c-rt:if>
                <c-rt:if test="${!empty wo.endClass2}">
        <c-rt:set var="cqt" value="${pu:get('com.yaodian100.crm.cs.entity.CommonQuestionType', wo.endClass2)}"/>
				${cqt.name} /
                </c-rt:if>
                <c-rt:if test="${!empty wo.endClass3}">
        <c-rt:set var="cqt" value="${pu:get('com.yaodian100.crm.cs.entity.CommonQuestionType', wo.endClass3)}"/>
		  ${cqt.name} </c-rt:if>
    	
    	</td>
    	</tr>
    	</c-rt:if>
    </table><br/>
    </c-rt:forEach>
    </div>
    </div>
    </c-rt:if>
    <c-rt:if test="${!empty nextWorkOrders}">
    	<div id="nextWorkOrder">
    	<table width="100%">
    	<tr>
    		<td width="250"><b>处理群组：</b>
			<c-rt:if test="${!empty nextWorkOrders[0].node.responseGroup}">
			${pu:get('com.yaodian100.core.admin.entity.Group', nextWorkOrders[0].node.responseGroup).description }(${nextWorkOrders[0].node.responseGroup })
					
			</c-rt:if>
			</td><td><b>处理人：</b>
			<c-rt:if test="${!empty nextWorkOrders[0].owner}">
			${nextWorkOrders[0].owner.username }
			</c-rt:if>
			</td>
    	</tr>
    	<tr>
    		<td colspan="2"><b>转单说明：</b>${nextWorkOrders[0].comment }</td>
    		
    	</tr>
    	</table>
    	</div>
    </c-rt:if>
    <c-rt:if test="${!empty fromWorkOrders}">
    	<div id="fromWorkOrder">
    		<c-rt:forEach items="${fromWorkOrders }" var="fwo">
    		<table>
    			<tr><th>工单编号</th><td>${fwo.id }</td></tr>
    			<tr><th>说明</th><td>${fwo.comment }</td></tr>
    		</table>
    		</c-rt:forEach>
    	</div>
    </c-rt:if>
    
    <div id="attach">
    	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tb-data">
    		<c-rt:if test="${empty questionAttach}">
    			<tr><td align="center">无附件</td></tr>
    		</c-rt:if>
    		<c-rt:if test="${!empty questionAttach}">
	    		<c-rt:forEach items="${questionAttach}" var="attach" varStatus="status">
	    			<tr>
	    				<td align="center">附件${status.count}</td>
	    				<td align="center"><img src="${attach.fileUri}" border="0"/></td>
	    			</tr>
	    		</c-rt:forEach>
	    	</c-rt:if>
    	</table>
    </div>
</div>

</div><!-- End demo -->

<%--
<form method="post" id="theForm" name="theForm">
  <c-rt:if test="${empty question}">
<input type="hidden" name="operation" value="save"/>
</c-rt:if>
<c-rt:if test="${!empty question}">
<input type="hidden" name="operation" value="update"/>
</c-rt:if>

<table class="tb-data" width="100%">
<c-rt:forEach items="${question.type.extraAttr.attributes }" var="attr" varStatus="status">
	<tr>
		<th>${attr.description }</th>
			<td>
				<c-rt:choose>
				<c-rt:when test="${attr.name=='class1' || attr.name=='class2' || attr.name=='commonQuestionType'}">
				
				
				<c-rt:set var="cqt" value="${pu:get('com.yaodian100.crm.cs.entity.CommonQuestionType', question.extraValue[attr.name].value)}"/>
				${cqt.name}
				
				</c-rt:when>
				<c-rt:when test="${attr.name=='mustInquire'}">
					<c-rt:if test="${!empty question.extraValue[attr.name].value}">
					<c-rt:set var="values" value="${pu:split(question.extraValue[attr.name].value, ',')}"/>
					<c-rt:forEach items="${values}" var="v">
						<c-rt:set var="pv" value="${pu:addToList('ps', pu:toLong(v))}"/>
					</c-rt:forEach>
					${pu:criteriaForName('com.yaodian100.crm.cs.entity.MustInquire') }
					${pu:criteriaAdd(pu:criteriaIn('id', pv))}
					<c-rt:set var="mis" value="${pu:criteriaResult(null)}"/>
					<c-rt:forEach items="${mis}" var="mi">
						${mi.description }<br/>
					</c-rt:forEach>
					</c-rt:if>
				</c-rt:when>
				<c-rt:otherwise>
				${question.extraValue[attr.name].value }
				</c-rt:otherwise>
				</c-rt:choose>
			</td>
	</tr>
</c-rt:forEach>
<c-rt:if test="${question.type.needAnswer && empty workOrder.parent && (workOrder.status==0 || workOrder.status==4)}">
	<tr>
	<th>回覆</th><td>
	<textarea name="answer" cols="50" rows="10"></textarea>
	</td>
	</tr>
	<c-rt:if test="${question.type.name=='ProductQAA'}">
	<tr>
	<th>将回覆显示在商品页</th><td>
	<input type="radio" name="showOnProductPage" value="true" checked="checked"/>是<input type="radio" name="showOnProductPage" value="false"/>否
	</td>
	</tr>
	</c-rt:if>
</c-rt:if>

<jsp:include page="forwardOrderPart.jsp"/>

	</table>

</form>
--%>
<%
}catch(Exception e){
    out.println(e);
}
%>

</c-rt:if>